package cn.nawang.ebeim.test.thread;

import cn.nawang.ebeim.test.constants.Config;
import cn.nawang.ebeim.test.queue.Queues;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by GanJc on 2015-12-08 17:07
 */
public class ThreadPool {

    private static ExecutorService executorService = Executors.newFixedThreadPool(1);

    public static void startUploadThread() {
        submitTask(new TaskExecutor(Queues.uploadTaskQueue));
    }

    public static void startDownloadThread() {
        submitTask(new TaskExecutor(Queues.downloadTaskQueue));
    }

    public static void submitTask(Runnable task){
        executorService.submit(task);
    }

}
